package org.dtrd.modules.quartz.job;

import lombok.extern.slf4j.Slf4j;
import org.dtrd.common.util.DateUtils;
import org.dtrd.config.wechat.api.impl.WechatApi;
import org.dtrd.config.wechat.config.WechatUtil;
import org.dtrd.config.wechat.entity.bean.AccessToken;
import org.quartz.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;

/**
 * @author 萧
 * @date:2021-10-21 5:57 下午
 **/
@PersistJobDataAfterExecution
@DisallowConcurrentExecution
@Slf4j
public class NiTangWechatJob implements Job {

    @Autowired
    @Lazy
    private WechatApi wechatApi;

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        AccessToken accessToken = wechatApi.getAccessToken(WechatUtil.getNiTangConfig().getAppId(), WechatUtil.getNiTangConfig().getAppSecret());
        log.info("NiTangWechatJob.execute.[context] 毅瑭科技检验AccessToken  当前时间：" + DateUtils.formatDateTime() + "； accessToken=" + accessToken);
    }
}
